use vudu
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Juan
-- =============================================
CREATE PROCEDURE sp_activar_pensum 
		@idPensum		     int,
		@fechaFin			 date,
		@fechaFinPeriod      date,
		@fechaInicioPeriod   date
		
		 
AS
BEGIN
	UPDATE Pensum SET statusPensum='ACTIVADO' WHERE id_Pensum =@idPensum
	UPDATE Pensum SET fechaFin=@fechaFin  WHERE id_Pensum =@idPensum
	INSERT INTO PERIODOACADEMICO VALUES ((select count(ID_PERIODOACADEMICO)+1 from PERIODOACADEMICO ),@fechaInicioPeriod,@fechaFin,@idPensum)
END
GO
